import service from '@/request/index';

// 获取右上角购物车详情
export const mini = () => {
    return service({
        url: '/mini',
        method: 'get',
    })
}

// 获取购物车列表
export const carts = () => {
    return service({
        url: '/carts',
        method: 'get',
    })
}

// 选中购物车
export const select = (data) => {
    return service({
        url: '/carts/select',
        method: 'post',
        data: JSON.stringify(data)
    })
}

// 不选中购物车
export const unselect = (data) => {
    return service({
        url: '/carts/unselect',
        method: 'post',
        data: JSON.stringify(data)
    })
}

// 加入购物车
export const addCart = (data) => {
    return service({
        url: '/carts',
        method: 'post',
        data: JSON.stringify(data)
    })
}

// 删除购物车
export const deleteCart = (params) => {
    return service({
        url: `/carts/${params}`,
        method: 'delete',
    })
}

// 删除所有的购物车
export const deleteAll = () => {
    return service({
        url: '/carts/deleteAll',
        method: 'post',
    })
}